package com.qingcloud.task.enums;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author zhengjibin
 * @version 1.0.0
 * @ClassName CommonEnum.java
 * @Description 断面枚举
 * @createTime 2021年08月06日 09:22:00
 */

public class TaskEnum {

    /**
     * 状态
     */
    public enum status{
        ZERO(0,"未开始"),
        ONE(1,"已开始"),
        TWO(2,"已完成");
        public int code;
        public String name;

        public static LinkedHashMap<Integer,String> map = new LinkedHashMap<>();
        static {
            status[] val = values();
            for(int i=0;i<val.length;i++){
                map.put(val[i].code,val[i].name);
            }
        }
        status(int code, String name) {
            this.code = code;
            this.name = name;
        }
        public static Integer getCode(String name) {
            for (Map.Entry<Integer,String> e : map.entrySet()) {
                if (e.getValue().equals(name)) {
                    return e.getKey();
                }
            }
            return null;
        }
        public static String getName(Integer code) {
            return map.get(code);
        }
    }

}
